﻿using System;
namespace Close.Data
{

    public partial class GameData
    {
        partial class ImprintedDataTable
        {
            public byte getvalue(ushort gid, int radek, int sloupec)
            {
                return (byte)((string)this.FindBygid(gid)[this.valuesColumn.ColumnName])[radek * 9 + sloupec];
            }
        }
        partial class SavedGameDataTable
        {

            public byte getvalue(ushort gid, int radek, int sloupec)
            {
                byte val = (byte)((string)this.FindBygid(gid)[this.valuesColumn.ColumnName])[radek * 9 + sloupec];
                return val;

            }
        }
        public partial class SavedGameRow
        {
            public char getValue(int radek, int sloupec)
            {
                return this.values[radek * 9 + sloupec];
            }

            /// <summary>
            /// Get notes in uint16 representation
            /// </summary>
            /// <param name="radek">row</param>
            /// <param name="sloupec">colums</param>
            public short GetNotes(int radek, int sloupec)
            {
                return BitConverter.ToInt16(this.notes, radek * 9 * 2 + sloupec * 2);

            }

            /// <summary>
            /// Set notes,
            /// </summary>
            /// <param name="notesInInt">notes in int16</param>
            public void SetNotes(short[] notesInInt)
            {
                byte[] nts = new byte[162];
                for (int ijk = 0; ijk < 81; ijk++)
                {
                    BitConverter.GetBytes(notesInInt[ijk]).CopyTo(nts, ijk * 2);
                }
                this.notes = nts;
            }
        }
    }
}
